<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <title>Hello APP</title>
    <link rel="stylesheet" type="text/css" href="../../css/index.css" />
    <link rel="stylesheet" type="text/css" href="../../script/lib/swiper.min.css"/>
    <link rel="stylesheet" type="text/css" href="css.css" />
    <style>
    	.warp{width: 100%;}
        .msg-box{width: 100%;padding: 12px 15px;box-sizing: border-box;position: relative;background: #ffffff;}
        .msg-box .msg-one{width: 100%;height: 40px;}
        .msg-box .msg-one .img-box{width: 40px;height: 40px;}
        .msg-box .msg-one .img-box img{width: 100%;height: 100%;}
        .msg-box .msg-one .cont{flex-direction: column;padding-left: 15px;box-sizing: border-box;justify-content: center;}

        .msg-box .msg-one .cont .type-box .type{font-size: 15px;color: #333333;font-weight: bold;}
        .msg-box .msg-one .cont .type-box .time{font-size: 12px;color: #8E9194;}
        .msg-box .msg-one .cont .title{font-size: 12px;color: #8E9194;padding-right: 40px;box-sizing: border-box;padding-top: 2px;}
        .msg-box .red{height:14px;padding: 0 5px;border-radius: 10px;background: #F13A3B;color: #ffffff;font-size: 8px;line-height:14px;text-align: center;position: absolute;right: 15px;bottom: 15px;}
    </style>
</head>

<body>
    <div id="vue" class="warp">

        <div class="msg-box border-bottom" data-title="系统消息" data-type="sys" tapmode onclick="openPage(this)" v-if="Pdata.sys">
        	<div class="msg-one flex">
                <div class="img-box"><img src="../../image/main0/msg_t1.png" alt=""></div>
                <div class="cont flex flex1">
                    <div class="type-box flex">
                        <div class="type flex1">系统消息</div>
                        <div class="time" v-if="Pdata.sys && Pdata.sys.newmsg && Pdata.sys.newmsg.addtime" v-text="Pdata.sys.newmsg.addtime"></div>
                    </div>
                    <div class="title flex1 han_1" v-if="Pdata.sys && Pdata.sys.newmsg && Pdata.sys.newmsg.title" v-text="Pdata.sys.newmsg.title"></div>
                </div>
        	</div>
            <div class="red" v-if="Pdata.sys && Pdata.sys.num > 0" v-text="Pdata.sys.num"></div>
        </div>

        <div class="msg-box border-bottom" data-title="审核消息" data-type="audit" tapmode onclick="openPage(this)" v-if="Pdata.audit">
        	<div class="msg-one flex">
                <div class="img-box"><img src="../../image/main0/msg_t2.png" alt=""></div>
                <div class="cont flex flex1" >
                    <div class="type-box flex">
                        <div class="type flex1">审核消息</div>
                        <div class="time" v-if="Pdata.audit && Pdata.audit.newmsg && Pdata.audit.newmsg.addtime" v-text="Pdata.audit.newmsg.addtime"></div>
                    </div>
                    <div class="title flex1 han_1" v-if="Pdata.audit && Pdata.audit.newmsg && Pdata.audit.newmsg.title" v-text="Pdata.audit.newmsg.title"></div>
                </div>
        	</div>
            <div class="red" v-if="Pdata.audit && Pdata.audit.num > 0" v-text="Pdata.audit.num"></div>
        </div>

        <div class="msg-box border-bottom" data-title="提现提醒" data-type="tixian" tapmode onclick="openPage(this)" v-if="Pdata.tixian">
        	<div class="msg-one flex">
                <div class="img-box"><img src="../../image/main0/msg_t3.png" alt=""></div>
                <div class="cont flex flex1">
                    <div class="type-box flex">
                        <div class="type flex1">提现提醒</div>
                        <div class="time" v-if="Pdata.tixian && Pdata.tixian.newmsg && Pdata.tixian.newmsg.addtime" v-text="Pdata.tixian.newmsg.addtime"></div>
                    </div>
                    <div class="title flex1 han_1" v-if="Pdata.tixian && Pdata.tixian.newmsg && Pdata.tixian.newmsg.title" v-text="Pdata.tixian.newmsg.title"></div>
                </div>
        	</div>
            <div class="red" v-if="Pdata.tixian && Pdata.tixian.num > 0" v-text="Pdata.tixian.num"></div>
        </div>

        <div class="msg-box border-bottom" data-title="商品下架提醒" data-type="downforced" tapmode onclick="openPage(this)" v-if="Pdata.downforced">
        	<div class="msg-one flex">
                <div class="img-box"><img src="../../image/main0/msg_t4.png" alt=""></div>
                <div class="cont flex flex1">
                    <div class="type-box flex">
                        <div class="type flex1">商品下架提醒</div>
                        <div class="time" v-if="Pdata.downforced && Pdata.downforced.newmsg && Pdata.downforced.newmsg.addtime" v-text="Pdata.downforced.newmsg.addtime"></div>
                    </div>
                    <div class="title flex1 han_1" v-if="Pdata.downforced && Pdata.downforced.newmsg && Pdata.downforced.newmsg.title" v-text="Pdata.downforced.newmsg.title"></div>
                </div>
        	</div>
            <div class="red" v-if="Pdata.downforced && Pdata.downforced.num > 0" v-text="Pdata.downforced.num"></div>
        </div>

        <div class="msg-box" data-title="订单消息" data-type="order" tapmode onclick="openPage(this)" v-if="Pdata.order">
        	<div class="msg-one flex">
                <div class="img-box"><img src="../../image/main0/msg_t5.png" alt=""></div>
                <div class="cont flex flex1">
                    <div class="type-box flex">
                        <div class="type flex1">订单消息</div>
                        <div class="time" v-if="Pdata.order && Pdata.order.newmsg && Pdata.order.newmsg.addtime" v-text="Pdata.order.newmsg.addtime"></div>
                    </div>
                    <div class="title flex1 han_1" v-if="Pdata.order && Pdata.order.newmsg && Pdata.order.newmsg.title" v-text="Pdata.order.newmsg.title"></div>
                </div>
        	</div>
            <div class="red" v-if="Pdata.order && Pdata.order.num > 0" v-text="Pdata.order.num"></div>
        </div>

    </div>

    <script type="text/javascript" src="../../script/base.min.js" id="loadjs" data-load="L/swiper.min,L/aui-scroll"></script>
    <script type="text/javascript">
    define(function (require, exports, module) {

        var setNew = 0;
        // 加数据
        _page.getData = function(loading) {
            lanYun.getVueData({url:'UserMsg/getNums',get:{page:lanYun.page},cache:1,loading:loading},function(ret) {
                //console.log(JSON.stringify(ret));
                if(setNew == 0){
                    setNew = 1;
                    getuserinfo();
                }
            });
        };

        lanYun.newVue('#vue',{
            Pdata:{}
        }, function() {
            _page.getData(2);
        });


        onShow = function () {
            intGetData();
		}

        //打开页面
	    openPage = function (tis) {
	        var dst = tis.dataset;
	        lanYun.openWin('main0/msg_list.html', {
	            win:'win',
                border:1,
                title:dst.title,
	            frameParam : dst
	        });
	    }

        //消息全部已读
		topMenuClick = function () {
            lanYun.alert({fname:'diaLogBox1',title:'提示', button:['取消','确定'],content: '您确定要设为全部已读？'},function(ret){
	            if (ret.index == 0) return;
				lanYun.get('UserMsg/setAllRead',function (ret){
					lanYun.toast(ret.msg);
					if(ret.errcode == 0){
                        intGetData();
                        getuserinfo();
					}
				},0)
	        });
		}

        //刷新列表
		intGetData = function () {
			lanYun.ajaxPageSta = 0; lanYun.page = 1;
			_page.getData(0);
		}

        //获取用户信息
        getuserinfo = function (){
            lanYun.get('User/getinfo' ,function (ret) {
                //console.log(JSON.stringify(ret));
                if(ret.errcode == 0){
                    lanYun.updateUdata(ret.data, 0);
                    lanYun.event('mainRed');
                }
            },0);
        }

    });
    </script>
</body>
</html>
